#include "label.h"
#include "QDebug"
#include "QMouseEvent"
Label::Label(QWidget *parent) : QLabel(parent)
{

}

void Label::mousePressEvent(QMouseEvent *ev)
{
    if(ev->button() == Qt::LeftButton)
    {
        qDebug() << "按下左键";
    }
    else if(ev->button() == Qt::RightButton)
    {
        qDebug() << "按下右键";
    }

    //qDebug() << ev->x() << "," << ev->y();
}

void Label::mouseReleaseEvent(QMouseEvent *ev)
{
    if(ev->button() == Qt::LeftButton)
    {
        qDebug() << "释放左键";
    }
    else if(ev->button() == Qt::RightButton)
    {
        qDebug() << "释放右键";
    }
}

void Label::mouseDoubleClickEvent(QMouseEvent *ev)
{
    if(ev->button() == Qt::LeftButton)
    {
        qDebug() << "双击左键";
    }
    else if(ev->button() == Qt::RightButton)
    {
        qDebug() << "双击右键";
    }
}
